/* 
 * File:   image.h
 * Author: gustavo
 *
 * Created on August 11, 2011, 6:25 AM
 */

#ifndef IMAGE_H
#define	IMAGE_H

#include "matrix.h"

typedef enum _image_type {
    IMAGE_TYPE_GRAY = 0,
    IMAGE_TYPE_RGB,
    IMAGE_TYPE_YUV,
    IMAGE_TYPE_HSV
} ImageType;

template <class T>
class Image : public Matrix<T> {
public:

    ImageType type;

    Image(int width, int height, ImageType type) : Matrix<T>() {
        switch (type) {
            case IMAGE_TYPE_GRAY:
                Matrix<T>::init(height, width, 1);
                break;
            case IMAGE_TYPE_RGB:
            case IMAGE_TYPE_HSV:
                Matrix<T>::init(height, width, 3);
                break;
            case IMAGE_TYPE_YUV:
                Matrix<T>::init(height * 1.5, width, 1);
        }
    }

    int getWidth() const;
    int getHeight() const;

};

template <class T>
int Image<T>::getWidth() const {
    return this->getColumns();
}

template <class T>
int Image<T>::getHeight() const {
    return this->getRows();
}

#endif	/* IMAGE_H */
